package org.yang.common.i18n.enums;

import lombok.Getter;
import org.yang.common.i18n.constant.I18nMessageConstant;

import java.io.Serializable;

/**
 * 返回内容枚举(国际化)
 *
 * @author: lslands
 * @version: 1.0
 * @create: 2024/5/10
 * @description:
 */
@Getter
public enum RI18nEnum implements Serializable {
    /**
     * 授权
     */
    LOGIN_SUCCESS(1,"登录成功",I18nMessageConstant.LOGIN_SUCCESS),
    LOGIN_ERROR(0,"登录失败",I18nMessageConstant.LOGIN_ERROR),
    ACCESS_UNAUTHORIZED(401,"访问未授权", I18nMessageConstant.ACCESS_UNAUTHORIZED),
    TOKEN_INVALID(403,"token无效或已过期", I18nMessageConstant.TOKEN_INVALID),
    TOKEN_ACCESS_FORBIDDEN(403,"token已被禁止访问", I18nMessageConstant.TOKEN_ACCESS_FORBIDDEN),

    /* 请求成功 20** */
    SUCCESS(2000,"成功", I18nMessageConstant.MESSAGE_SUCCESS),
    CREATE(2001,"创建成功", I18nMessageConstant.MESSAGE_CREATE_SUCCESS),
    UPDATE(2002, "更新成功",I18nMessageConstant.MESSAGE_UPDATE_SUCCESS),
    DELETE(2003, "删除成功",I18nMessageConstant.MESSAGE_DELETE_SUCCESS),
    UPLOAD(2004, "上传成功",I18nMessageConstant.MESSAGE_UPLOAD_SUCCESS),
    /* 请求失败 40** */
    FAIL(4000,"失败", I18nMessageConstant.MESSAGE_FAIL),
    UNAUTHORIZED(401,"未授权",I18nMessageConstant.UNAUTHORIZED),
    CREATE_FAIL(4001,"创建失败", I18nMessageConstant.MESSAGE_CREATE_FAIL),
    UPDATE_FAIL(4002,"更新失败", I18nMessageConstant.MESSAGE_UPDATE_FAIL),
    DELETE_FAIL(4003, "删除失败",I18nMessageConstant.MESSAGE_DELETE_FAIL),
    UPLOAD_FILE(4004, "下载成功",I18nMessageConstant.MESSAGE_UPDALOD_FAIL),
    NOT_NULL(4004,"必要参数不能为空",I18nMessageConstant.VALIDATION_EMPTY),
    CONFLICT_FAIL(4009,"存在重复内容",I18nMessageConstant.MESSAGE_CONFLICT_FAIL),
    METHOD_NOT_ALLOWED(4010,"请求方式有误",I18nMessageConstant.MESSAGE_METHOD_NOT_ALLOWED),
    VALIDATION_MODEL(4011,"校验失败",I18nMessageConstant.VALIDATION_CHINESE),
    /* 请求失败 50** */
    ERROR(5000,"服务错误，请联系管理员", I18nMessageConstant.MESSAGE_SERVER_ERROR),

    ;
    /**
     * 状态码
     */
    private final Integer code;
    /**
     * 返回消息
     */
    private final String zhMsg;

    private final String localMsg;

    RI18nEnum(int code, String zhMsg, String localMsg){
        this.code=code;
        this.zhMsg= zhMsg;
        this.localMsg=localMsg;
    }
}
